home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 51 / Amiga Format CD51 (2000-03-10)(Future Publishing)(GB)[!][issue 2000-04].iso / -in_the_mag- / banging_the_metal / qdos / qdos4amiga2 / romsrc / sys / basic3_asm < prev    next >
Text File  |  2000-01-03  |  3KB  |  95 lines

  1. */beginfile BASIC3_asm
  2. ; --------------------------------------------------------------
  3. ; BASIC3_asm - BASIC bits
  4. ;        - last modified 27/11/96
  5. ; QDOS-Amiga sources by Rainer Kowallik
  6. ;  ...latest changes by Mark J Swift
  7. ; --------------------------------------------------------------
  8. L06DA2:
  9.     LEA    BASIC_KEys(PC),A1
  10. ; Vectored utility BP_INIT
  11. ; A1=pointer to definition list
  12. BP_INIT:
  13.     MOVEM.L    D1-D2/D5-D7/A0/A2-A3,-(A7)
  14.     MOVEQ    #8,D6        ; identifier for machinecode
  15.                 ; procedure
  16. L06DAC:
  17.     MOVEQ    #0,D7
  18.     MOVEQ    #0,D5
  19.     MOVE.W    (A1)+,D5     ; get number of procedures
  20.     LSL.L    #3,D5        ; * 8 since we have two long
  21.                 ; word pointers
  22.     MOVE.L    D5,D1
  23.     MOVE.L    A1,-(A7)
  24.     JSR    L04E60(PC)    ;*/undomodify BSR L04E60
  25.                 ; allocate space for name
  26.                 ; table
  27.     MOVE.L    D5,D1
  28.                 ;*/undoinsert LSL.L #1,D1
  29.                 ; assume names are 14 bytes
  30.                 ; long. !!!! NEW !!!!
  31.     JSR    L04E72(PC)    ;*/undomodify BSR L04E72
  32.                 ; allocate memory for name
  33.                 ; list
  34.     MOVEA.L    (A7)+,A3     ; get pointer to procedure
  35.                 ; list -> A3 !!!
  36. L06DC4:
  37.     MOVEA.L    A3,A1        ; save pointer to procedure
  38.                 ; list for offset
  39.     MOVE.W    (A3)+,D0     ; get address of procedure
  40.     BEQ.S    L06E0C        ; if end of procedure list
  41.     ADDA.W    D0,A1        ; calculate absolute address
  42.     MOVE.L    A1,-(A7)
  43.     MOVE.B    (A3)+,D5     ; length of procedure name
  44.     MOVE.B    D5,-(A7)
  45.     MOVE.B    D6,-(A7)
  46.     MOVE.B    D5,D1
  47.     MOVEA.L    (A6),A1        ; get buffer base
  48. L06DD8    MOVE.B    (A3)+,0(A6,A1.L)    ; copy name of procedure to
  49.                 ; buffer
  50.     ADDQ.W    #1,A1
  51.     SUBQ.B    #1,D1
  52.     BGT.S    L06DD8        ; continue copy
  53.     MOVE.L    A3,-(A7)     ; save pointer to procedure
  54.                 ; list
  55.     MOVEA.L    (A6),A3        ; aagain get buffer address
  56. RLOC15    movea.l    #(TB_LIST-ORGN),a2  ;*/modify LEA TB_LIST(PC),A2
  57.     MOVEA.L    (A2),A2
  58.     JSR    L08622(PC)    ;*/undomodify BSR L08622
  59.                 ; check name in Buffer and
  60.                 ; get address of name table
  61.     BRA.S    L06E16        ; bad name return
  62.     MOVEA.L    (A7)+,A3     ; restore pointer to
  63.                 ; procedure list
  64.     MOVE.B    (A7)+,D6
  65.     MOVE.B    (A7)+,D5     ; restore length of name
  66.     MOVE.L    (A7)+,4(A6,A2.L)    ; write Address of procedure
  67.                 ; to name table
  68.     MOVE.B    D6,0(A6,A2.L)    ; identifier procedure /
  69.                 ; function
  70.     MOVE.B    D7,1(A6,A2.L)    ; identifier string / float
  71.                 ; / int
  72.     BTST    D7,D5        ; even number of bytes ?
  73.     BNE.S    L06DC4        ; continue with next
  74.                 ; procedure
  75.     ADDQ.W    #1,A3        ; make it even
  76.     BRA.S    L06DC4        ; continue with next
  77.                 ; procedure
  78. L06E0C    SUBQ.W    #8,D6        ; was it Procedure or
  79.                 ; function before ?
  80.     BNE.S    L06E1C        ; return if it was already
  81.                 ; for functions
  82.     MOVEQ    #9,D6        ; if not, set function
  83.                 ; identifier now
  84.     MOVEA.L    A3,A1
  85.     BRA.S    L06DAC        ; and continue linking in
  86.                 ; like procedure
  87. L06E16    ADDA.W    #12,A7        ; clean up stack for error
  88.                 ; return
  89.     MOVEQ    #-12,D0        ; Bad name error
  90. L06E1C    MOVEM.L    (A7)+,D1-D2/D5-D7/A0/A2-A3
  91.     RTS
  92. ;  end of BP_INIT
  93. ; --------------------------------------------------------------
  94. ;*/endfile
  95.